<#include "../teacherNavigation/index.html">
<#if message?exists>
	${message}
</#if>




 <script src="//cdn.bootcss.com/bootstrap-validator/0.5.3/js/bootstrapValidator.js"></script>
 <link href="//cdn.bootcss.com/bootstrap-validator/0.5.3/css/bootstrapValidator.min.css" rel="stylesheet" />
				<div class="main-content">
						<div class="breadcrumbs" id="breadcrumbs">
							<script type="text/javascript">
								try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
							</script>
	
							<ul class="breadcrumb">
								<li>
									<i class="icon-home home-icon"></i>
									<a href="${contextPath}/teacher/index">教学日历服务平台教师首页</a>
								</li>
								<li class="active">课程列表</li>
							</ul><!-- .breadcrumb -->
						</div>
                   <div class="page-content">
                   
	        	          <div class="page-header" style="padding-bottom:45px;">
									
							  <label>学期</label>
						       <br>
						       <select id="year" name="year"
										class="form-control"  onchange="change(this)" style="width:50%;"><#if
										listAll??> <#list listAll as mn><option value="${mn}">${mn}</option> </#list> </#if>
								
							  </select> 
							</div><!-- /.page-header -->
        
                   	<div class="row">
							<div class="col-xs-12">
							

							<table style="font-size:17px;" cellspacing="0" cellpadding="0">
      							<tr>
        							<th>我的授课</th>
        							<th>授课开始日</th>
        							<th>授课结束日</th>
        							<th>授课星期</th>
        							<th>提纲上传</th>
        							<th>提纲下载</th>
        							<th>提纲删除</th>
     							</tr>
     						<tbody id="tbody">
      								
      								</tbody>
    						</table>		
    			      </div><!-- /.col-xs-12 -->				 
					</div><!-- /.rowr -->	
               
				   </div><!-- /.page-content -->
				   <div id="modal-overlay3">
						<div class="modal-data3">

							<div  class="login" style="width:560px;height:200px;">
								<form action="${contextPath}/teacher/importCoursePoint" method="post" enctype="multipart/form-data" >
								<h2 style="color:#2795DC;font-weight:bold;font-size:2em;">授课提纲导入</h2>
								<hr>
								<div class="control-group" style="margin-bottom:15px;">
									
									<div class="controls" >
										<div class="am-form-group am-form-file">
  											<button type="button" class="am-btn am-btn-danger am-btn-sm" style="background:#2795dc;border-color:#2795dc;">
    										<i class="am-icon-cloud-upload"></i> 选择要上传的文件</button>
  									        <input type="hidden" id="pkCourse" name="pkCourse" >
  											<input type="file" name="excelFile"  multiple >		
										</div>
										<div id="file-list"></div>
									</div>							
								</div>
							
								<button class="am-btn am-btn-secondary" type="submit" style="margin-top:10px;">上传</button>
								<button class="am-btn am-btn-secondary" type="button" style="margin-left:40%;margin-top:10px;" onclick="closeLogin3()">关闭</button>
								</form>
												
							</div>
						</div>
					</div>
				
				      <script id="template" type="html/template">
                                   <tr>
      									<td id="courseName"></td>
      									<td id="courseStart"></td>
      									<td id="courseEnd"></td>
      									<td id="courseDay"></td>
      									<td id="upload"></td>
      									<td id="download"></td>
                                        <td id="deleteFile"></td>
      								</tr>
                      </script>
				   	<script type="text/javascript">
				  //yan:这个js不能移动
	
				   	
					function change(obj)
					{ 
                     var year = obj.value;
						$.ajax({
							type:"post",				
							url:"${contextPath}/teacher/findCourseRecordByYear",
							data:{year:year}, 
							dataType:  "json", 
							error:function(err){alert(err);},
							success:function loadAd(data)
							{    
								$("#tbody").empty();
								for(var i = data.length - 1; i >= 0; i--){
									
									let dataSource = data[i];
									let pkCourse= dataSource["pkCourse"];
									let courseName = dataSource["courseName"];
									let courseStart = dataSource["courseStart"];
									let courseEnd= dataSource["courseEnd"];
									let courseDay= dataSource["courseDay"];
									let temp = $("#template").html();							
									let tr = $(temp);
									let classname = tr.find("#courseName");
									let classstart = tr.find("#courseStart");
									let classend= tr.find("#courseEnd");
									let classday = tr.find("#courseDay");
									let upload = tr.find("#upload");
									let download = tr.find("#download");
									let deleteFile = tr.find("#deleteFile");
									classname.text(courseName);
									classstart.text(courseStart);
									classend.text(courseEnd);
									classday.text(courseDay);
									upload.html("<button onclick='overFind3("+pkCourse+")' class='button_blue' style='margin-left:20%;'>点击上传</button>");
									download.html("<a href='${contextPath}/teacher/courseManage/download?pkCourse="+pkCourse+"'>下载</a>");
									//这个是一个典型的传参数方法，？后面加值，然后在Spring中就是在control里面加注解@RequestParam
									deleteFile.html("<a href='${contextPath}/teacher/courseManage/deleteFile?pkCourse="+pkCourse+"'>删除</a>");
									$("#tbody").append(tr);	
									
								}	
	
							},
						});
						
						
					}
				   	
					 </script > 	
			<script type="text/javascript">
					function overFind3(pkCourse){     
							var e1 = document.getElementById('modal-overlay3');     
								e1.style.visibility = (e1.style.visibility == "visible")? "hidden" : "visible";
						$(".modal-data3").animate({right:'30%'});
						$("#pkCourse").val(pkCourse);
						}
						function closeLogin3(){    
							var e1 = document.getElementById('modal-overlay3');     
								e1.style.visibility = "hidden";
						}
				</script>

      
		</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		